﻿<UserControl xmlns:PageBar="clr-namespace:Mengsk.ProxyDelivery.App.UI.PageBar"  
             x:Class="Mengsk.ProxyDelivery.App.UI.Order.OrderAllUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:orderui="clr-namespace:Mengsk.ProxyDelivery.App.UI.Order"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             d:DesignHeight="300" d:DesignWidth="1100" Loaded="UserControl_Loaded">

    <UserControl.Resources>
        <orderui:AddPriceConverter x:Key="addPriceConverter"/>
        <Style x:Key="ModifyPriceButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnSetPrice_Click"/>
        </Style>
        <Style x:Key="CloseOrderGoodsButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnCloseOrderGoods_Click"/>
        </Style>
        <Style x:Key="CloseOrderButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnCloseOrder_Click"/>
        </Style>
        <Style x:Key="ModifyButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnModify_Click"/>
        </Style>
        <Style x:Key="ModifyDeliveryInfoButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnModifyDeliveryInfo_Click"/>
        </Style>
        <Style x:Key="ImageButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="GoodsImage_Click"/>
        </Style>
        <Style x:Key="CopyStockButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnCopyStock_Click"/>
        </Style>
        <Style x:Key="CreateReturnButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnCreateRefund_Click"/>
        </Style>

        <Style x:Key="ModifyStockButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnModifyStock_Click"/>
        </Style>

        <Style x:Key="QueryDeliveryButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnDeliveryNumber_Click"/>
        </Style>

        <Style x:Key="CopyDeliveryNumberButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnCopyDelivery_Click"/>
        </Style>

        <Style x:Key="SpilteOrderButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnSpilteOrder_Click"/>
        </Style>

        <Style x:Key="ModifyReceiverInfoButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnModifyReceiverInfo_Click"/>
        </Style>
        <Style x:Key="AddOrderGoodsButton" TargetType="Button" BasedOn="{StaticResource TextButton}">
            <EventSetter Event="Click" Handler="btnAddOrderGoods_Click"/>
        </Style>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Text="卖家编号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="0" Grid.Column="1" Name="tbSellerId" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="0" Grid.Column="2" Text="买家账号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="0" Grid.Column="3" Name="tbBuyName" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="0" Grid.Column="4" Text="收件人电话:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="0" Grid.Column="5" Name="tbReceiverPhone" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="0" Grid.Column="6" Text="收件人手机:"  Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="0" Grid.Column="7" Name="tbReceiverMobile" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="0" Grid.Column="8" Text="收件人姓名:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="0" Grid.Column="9" Name="tbReceiverName" Margin="3" VerticalAlignment="Center"/>

            <TextBlock Grid.Row="2" Grid.Column="0" Text="订单编号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="2" Grid.Column="1" Name="tbId" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="2" Grid.Column="2" Text="订单状态:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Grid.Row="2" Grid.Column="3" Name="cbbState" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="2" Grid.Column="4" Text="订单类型:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Grid.Row="2" Grid.Column="5" Name="cbbPopPayType" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="2" Grid.Column="6" Text="待补差价:" Margin="3 " VerticalAlignment="Center"/>
            <ComboBox Grid.Row="2" Grid.Column="7" Name="cbbNeedMoreMoney" Margin="3" VerticalAlignment="Center">
                <ComboBoxItem>所有</ComboBoxItem>
                <ComboBoxItem>付款完全</ComboBoxItem>
                <ComboBoxItem>待补差价</ComboBoxItem>
                <ComboBox.SelectedIndex>0</ComboBox.SelectedIndex>
            </ComboBox>
            <TextBlock Grid.Row="2" Grid.Column="8" Text="商品货号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="2" Grid.Column="9" Name="tbNumber" Margin="3" VerticalAlignment="Center"/>

            <TextBlock Grid.Row="1" Grid.Column="0" Text="时间类型:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Grid.Row="1" Grid.Column="1" Name="cbbTimeType" Margin="3" VerticalAlignment="Center">
                <ComboBoxItem>创建时间</ComboBoxItem>
                <ComboBoxItem>付款时间</ComboBoxItem>
                <ComboBoxItem>打印时间</ComboBoxItem>
                <ComboBoxItem>发货时间</ComboBoxItem>
                <ComboBoxItem>关闭时间</ComboBoxItem>
                <ComboBox.SelectedIndex>0</ComboBox.SelectedIndex>
            </ComboBox>
            <TextBlock Grid.Row="1" Grid.Column="2" Text="开始时间:" Margin="3" VerticalAlignment="Center"/>
            <xctk:DateTimePicker xctk:Format="Custom" xctk:TimeFormatString="yyyy-MM-dd HH:mm:ss" Grid.Row="1" Grid.Column="3" Name="dpStart" Margin="3" VerticalAlignment="Center" MinWidth="140"/>
            <TextBlock Grid.Row="1" Grid.Column="4" Text="结束时间:" Margin="3" VerticalAlignment="Center"/>
            <xctk:DateTimePicker Grid.Row="1" xctk:Format="Custom"  xctk:TimeFormatString="yyyy-MM-dd HH:mm:ss" Grid.Column="5" Name="dpEnd" Margin="3" VerticalAlignment="Center" MinWidth="140"/>
            <TextBlock Grid.Row="1" Grid.Column="6" Text="收货人地址:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="1" Grid.Column="7"  Name="tbAddress" Margin="3" VerticalAlignment="Center"/>
            <TextBlock Grid.Row="1" Grid.Column="8" Text="发出单号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Grid.Row="1" Grid.Column="9" Name="tbDeliveryNumber" Margin="3" VerticalAlignment="Center" PreviewKeyDown="tbDeliveryNumber_PreviewKeyDown"/>

            <Grid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="10">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <CheckBox Grid.Column="0" Name="chkCheckAll" Content="全选" Margin="3" VerticalAlignment="Center" Checked="chkCheckAll_Checked" Unchecked="chkCheckAll_Checked"/>
                <TextBlock Grid.Column="1" Name="tbTotalMoney" Margin="3" VerticalAlignment="Center"/>

                <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button  Content="查询" Name="btnSearch" Margin="3" VerticalAlignment="Center" Width="60" HorizontalAlignment="Right" Click="btnSearch_Click"/>
                    <Button  Content="导出本页商品" Name="btnExport" Margin="3" VerticalAlignment="Center"  HorizontalAlignment="Right" Click="btnExport_Click"/>
                </StackPanel>
            </Grid>
        </Grid>

        <ListBox Grid.Row="3" Name="lstItems" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Margin" Value="1,0,1,3"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <GroupBox Padding="0" Margin="0">
                                    <GroupBox.Header>
                                        <Grid >
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition Width="100"/>
                                                <ColumnDefinition Width="140"/>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition MinWidth="80" MaxWidth="150"/>
                                                <ColumnDefinition MinWidth="80" MaxWidth="150"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="300*"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="2" Text="订单编号:" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="3" Style="{StaticResource SelectableTextBox}"  Text="{Binding Source.Id}" Margin="3" VerticalAlignment="Center"/>
                                            <TextBlock Grid.Column="4" Text="{Binding Source.CreateTime,Converter={StaticResource datetimeConverter}}" Margin="3" VerticalAlignment="Center"/>
                                            <TextBlock Grid.Column="5" Text="{Binding Source.PopType,Converter={StaticResource descriptionConverter}}" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox  Grid.Column="6" Style="{StaticResource SelectableTextBox}" Text="{Binding Source.SellerId}" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="7" Style="{StaticResource SelectableTextBox}"  Text="{Binding Source.PopBuyerId}" Margin="3" VerticalAlignment="Center"/>
                                            <TextBlock Grid.Column="9"  Text="{Binding Source.CreateReason,Converter={StaticResource descriptionConverter}}" Margin="3"/>
                                            <TextBlock Grid.Column="10" Grid.ColumnSpan="2" Text="{Binding Source.CloseTime,Converter={StaticResource datetimeConverter},ConverterParameter=关闭时间:}" Margin="3" VerticalAlignment="Center" Width="200"/>
                                            <Button Grid.Column="12" Content="关闭" Tag="{Binding}" Style="{StaticResource CloseOrderButton}" Name="btnCloseOrder"  VerticalAlignment="Center" Margin="3"/>
                                            <Button Grid.Column="13" Content="拆分" Tag="{Binding}" Style="{StaticResource SpilteOrderButton}" Name="btnSpilteOrder" VerticalAlignment="Center" Margin="3"/>
                                            <Button Grid.Column="14" Content="增加商品" Tag="{Binding}" Style="{StaticResource AddOrderGoodsButton}" Name="btnAddOrderGoods" VerticalAlignment="Center" Margin="3"/>
                                        </Grid>
                                    </GroupBox.Header>
                                    <StackPanel Orientation="Vertical">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="400*"/>
                                                <ColumnDefinition Width="1"/>
                                                <ColumnDefinition Width="100"/>
                                                <ColumnDefinition Width="1"/>
                                                <ColumnDefinition Width="150"/>
                                                <ColumnDefinition Width="1"/>
                                                <ColumnDefinition Width="150" />
                                            </Grid.ColumnDefinitions>

                                            <Grid Grid.Column="0">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto"/>
                                                    <RowDefinition Height="Auto"/>
                                                </Grid.RowDefinitions>
                                                <ListBox Grid.Row="0" ItemsSource="{Binding Source.OrderGoodss}">
                                                    <ListBox.ItemContainerStyle>
                                                        <Style TargetType="ListBoxItem">
                                                            <Setter Property="Template">
                                                                <Setter.Value>
                                                                    <ControlTemplate>
                                                                        <Grid>
                                                                            <Grid.RowDefinitions>
                                                                                <RowDefinition Height="Auto"/>
                                                                                <RowDefinition Height="Auto"/>
                                                                            </Grid.RowDefinitions>
                                                                            <Grid Grid.Row="0">
                                                                                <Grid.ColumnDefinitions>
                                                                                    <ColumnDefinition Width="Auto"/>
                                                                                    <ColumnDefinition Width="100*"/>
                                                                                    <ColumnDefinition Width="100"/>
                                                                                    <ColumnDefinition Width="50"/>
                                                                                    <ColumnDefinition Width="120"/>
                                                                                </Grid.ColumnDefinitions>

                                                                                <Grid.RowDefinitions>
                                                                                    <RowDefinition Height="Auto"/>
                                                                                    <RowDefinition Height="Auto"/>
                                                                                    <RowDefinition Height="Auto"/>
                                                                                </Grid.RowDefinitions>

                                                                                <Button BorderBrush="White" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BorderThickness="0" Tag="{Binding NumberId}" Style="{StaticResource ImageButton}">
                                                                                    <Image Source="{Binding Image,Converter={StaticResource webUrlImageConverter}}" Margin="3" Height="60" Width="60" Stretch="Fill" Tag="{Binding NumberId}"/>
                                                                                </Button>
                                                                                <StackPanel  Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="3">
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Vendor}"/>
                                                                                        <TextBlock Text=" "/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Vendor,Converter={StaticResource vendorDoorConverter}}"/>
                                                                                        <TextBlock Text=" "/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Number}"/>
                                                                                        <TextBlock Text=" "/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Edtion}"/>
                                                                                        <TextBlock Text=" 商品编号:"/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding NumberId}"/>
                                                                                        <TextBlock Text=" "/>
                                                                                    </StackPanel>
                                                                                    <StackPanel Grid.Row="1" Grid.Column="1"  Orientation="Horizontal">
                                                                                        <TextBlock Text="颜色:" VerticalAlignment="Center"/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Color}" VerticalAlignment="Center"/>
                                                                                        <TextBlock Text="尺码:" VerticalAlignment="Center" Margin="10,0,0,0"/>
                                                                                        <TextBox Style="{StaticResource SelectableTextBox}" Text="{Binding Size}" VerticalAlignment="Center"/>
                                                                                    </StackPanel>
                                                                                </StackPanel>
                                                                                <StackPanel Orientation="Horizontal" Grid.Column="2" Margin="3">
                                                                                    <TextBlock Text="{Binding Price}" VerticalAlignment="Top"/>
                                                                                    <TextBlock Text="{Binding AddPrice,Converter={StaticResource addPriceConverter}}" Foreground="Red" VerticalAlignment="Top"/>
                                                                                </StackPanel>
                                                                                <TextBlock Grid.Column="3" Text="{Binding Count}" VerticalAlignment="Top" Margin="3"/>
                                                                                <StackPanel Grid.Column="4" Orientation="Vertical">
                                                                                    <TextBlock Text="{Binding State,Converter={StaticResource descriptionConverter}}" VerticalAlignment="Top" Margin="3"/>
                                                                                    <TextBlock Text="{Binding StockingComment}" Margin="3" VerticalAlignment="Center"/>
                                                                                </StackPanel>

                                                                                <StackPanel Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
                                                                                    <Button Content="设置价差" Name="btnSetPrice" Style="{StaticResource ModifyPriceButton}" Tag="{Binding}"  VerticalAlignment="Top" Margin="3"/>
                                                                                    <Button Content="修改属性" Name="btnModify" Style="{StaticResource ModifyButton}" Tag="{Binding}" Margin="3" VerticalAlignment="Center"/>
                                                                                    <Button Content="创建退货" Name="btnCreateRefund" Style="{StaticResource CreateReturnButton}" Tag="{Binding}"  Margin="3" VerticalAlignment="Center"/>
                                                                                    <Button Content="缺货设置" Name="btnModifyStock" Style="{StaticResource ModifyStockButton}" Tag="{Binding}" Margin="3" VerticalAlignment="Center"/>
                                                                                    <Button Content="复制信息" Name="btnCopyStock" Style="{StaticResource CopyStockButton}" Tag="{Binding}" Margin="3" VerticalAlignment="Center"/>
                                                                                </StackPanel>

                                                                            </Grid>
                                                                            <Line Grid.Row="1"  Stroke="LightGray" StrokeThickness="1" Stretch="Fill" X1="0" Y1="0" X2="10" Y2="0"/>
                                                                        </Grid>
                                                                    </ControlTemplate>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Style>
                                                    </ListBox.ItemContainerStyle>
                                                </ListBox>

                                                <Grid Grid.Row="1">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBlock Grid.Column="0" Text="服务费用:" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBlock Grid.Column="1" Text="{Binding Source.TotalServiceMoney}" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBlock Grid.Column="2" Text="礼品费用:" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBlock Grid.Column="3" Text="{Binding Source.TotalGiftMoney}" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBlock Grid.Column="4" Text="快递费用:" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBlock Grid.Column="5" Text="{Binding Source.TotalDeliveryMoney}" Margin="3" VerticalAlignment="Center"/>
                                                    <TextBox Grid.Column="6" Style="{StaticResource SelectableTextBox}" TextWrapping="Wrap" Text="{Binding  Path=Source, Converter={StaticResource orderReceiverInfoConver},Mode=OneWay}" Margin="30,0,0,0"  VerticalAlignment="Center"/>
                                                    <Button Grid.Column="7"  HorizontalAlignment="Right" Tag="{Binding}" Content="修改信息" Style="{StaticResource ModifyReceiverInfoButton}" Margin="3" VerticalAlignment="Center" Name="btnModifyReceiverInfo"/>
                                                </Grid>
                                            </Grid>

                                            <Line Grid.Column="1"  Stroke="LightGray" StrokeThickness="1" Stretch="Fill" X1="0" X2="0" Y1="0" Y2="10"/>
                                            <Line Grid.Column="3"  Stroke="LightGray" StrokeThickness="1" Stretch="Fill"  X1="0" X2="0" Y1="0" Y2="10"/>
                                            <Line Grid.Column="5" Stroke="LightGray" StrokeThickness="1" Stretch="Fill"  X1="0" X2="0" Y1="0" Y2="10"/>

                                            <StackPanel Grid.Column="2" Orientation="Vertical">
                                                <TextBlock Text="{Binding Source.TotalMoney}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                                    <TextBlock Text="{Binding Source.Weight}" Margin="3,3,0,3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                    <TextBlock Text="KG" Margin="0,3,3,3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                </StackPanel>
                                                <Button Name="btnDetail" Margin="3" Content="详情" Style="{StaticResource TextButton}" VerticalAlignment="Center" Click="btnDetail_Click" Tag="{Binding Source}" HorizontalAlignment="Center"/>
                                            </StackPanel>

                                            <StackPanel Grid.Column="4" Orientation="Vertical">
                                                <TextBlock Text="{Binding Source.PopPayType,Converter={StaticResource descriptionConverter}}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                <TextBlock Text="{Binding Source.DeliveryCompany}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                                    <Button Content="{Binding Source.DeliveryNumber}" Style="{StaticResource QueryDeliveryButton}" Tag="{Binding}" Foreground="Green" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                    <Button Content="复" Style="{StaticResource CopyDeliveryNumberButton}" Margin="0,3,0,3" Name="btnCopyDelivery" Tag="{Binding Source.DeliveryNumber}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                </StackPanel>
                                                <Button Name="btnModifyDeliveryInfo" Margin="3" Content="修改快递" Style="{StaticResource ModifyDeliveryInfoButton}" VerticalAlignment="Center" Tag="{Binding Source}" HorizontalAlignment="Center"/>
                                            </StackPanel>
                                            <StackPanel Grid.Column="6" Orientation="Vertical">
                                                <TextBlock Text="{Binding Source.State,Converter={StaticResource descriptionConverter}}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                                <TextBlock Text="{Binding Source.ErrorCode,Converter={StaticResource orderErrorCodeConverter}}" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"/>
                                            </StackPanel>
                                        </Grid>
                                        <Line Grid.Row="1"  Stroke="LightGray" StrokeThickness="1" Stretch="Fill" X1="0" Y1="0" X2="10" Y2="0"/>
                                        <Grid >
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" Text="系统备注:" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="1" Style="{StaticResource SelectableTextBox}" Text="{Binding Source.SysComment}" Margin="3" VerticalAlignment="Center" TextWrapping="Wrap"/>
                                            <Button Grid.Column="2" HorizontalAlignment="Right" Name="btnModifyComment" Margin="3" VerticalAlignment="Center" Tag="{Binding}" Click="btnModifyComment_Click" Content="编辑备注"/>
                                        </Grid>

                                    </StackPanel>
                                </GroupBox>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
        <PageBar:PageBarUserControl Grid.Row="4" x:Name="pbBar" PageSize="30"  PageChanging="pbBar_PageChanging"/>

    </Grid>
</UserControl>
